﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建“用户信息”文件夹
            DirectoryInfo directoryInfo = new DirectoryInfo("D:\\用户信息");

            //创建目录
            directoryInfo.Create();

            //创建子目录
            directoryInfo.CreateSubdirectory("小明");
            directoryInfo.CreateSubdirectory("小红");

            //删除指定目录
            Directory.Delete("D:\\用户信息\\小红");

            //创建文件
            FileInfo fileInfo = new FileInfo("D:\\用户信息\\考试成绩.txt");
            fileInfo.Create().Close();
            string path = "D:\\用户信息\\考试成绩.txt";

            //获取文件相关信息
            fileInfo.Attributes = FileAttributes.Normal;
            Console.WriteLine("文件路径：" + fileInfo.Directory);
            Console.WriteLine("文件名称：" + fileInfo.Name);
            Console.WriteLine("文件是否只读：" + fileInfo.IsReadOnly);
            Console.WriteLine("文件大小：" + fileInfo.Length);
            Console.WriteLine("文件创建时间：" + File.GetCreationTime(path));
        }
    }
}
